-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render_block_context
another approach that solve the context issue
#7522
render_block_context
another approach that solve the context issue
#7522
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
@mukeshpanchal27 Heads up that the tests in #7344 have been updated to reflect the last few comments there. |
Nice one @mukeshpanchal27. @dlh01 and @joemcgill, it looks like all the unit tests we could think of pass in this branch. How do you feel about the proposed solution? Is it good enough to move forward as part of the WP 6.7 release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mukeshpanchal27 This looks very promising. Mostly questions from my end, to make sure I understand this correctly.
Thanks for the ping! I should be able to take a look at this Wednesday or Thursday. |
render_block_context
another approachrender_block_context
another approach that solve the context issue
The PR is ready for review. Address the feedbacks. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Yes, that’s exactly what I was thinking about in terms of backward compatibility. It seems like a viable path forward. We can explore specific details of the depreciation strategy separately later. I was thinking also about making the context a virtual property and handle everything through magic methods. Whatever works best here 😀 |
That was my first thought too, but I think that wouldn't work because magic methods would only be called for the entire |
I think got it know, we would pass |
That's actually not entirely what I thought, but that's even better than what I thought 😆 So let's try that. |
@gziolo and @felixarntz, I've been spending time today catching up on this conversation and wanted to summarize what I understand to be the current thinking. Based on what @gziolo said is his preferred solution, the Conceptually, this makes sense to me, and I think could be achieved by filtering the In practice, however, the I've put together the following visual to help illustrate the concept of block context as it currently exists: Restating what is in the illustration:
If applying the filter to
Whether or not we then change the current ability for a block's |
Thanks for the helpful summary and visualization @joemcgill. It makes sense for now to focus on only addressing the bug that As far as I can tell, to fix that this PR is almost there. It would be great to get your code review as well based on your understanding. |
@joemcgill, thank you for your analysis to this complex problem. I agree with the proposed path forward, where the focus moves on solving one problem at a time. In effect, we seem to have a path forward to land this PR after addressing the feedback continued by @felixarntz. I'm happy to have another look from that angle next week. |
@felixarntz I have addressed the recent feedback and PR is ready for review.
@gziolo Happy to get your feedback if you have moments. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mukeshpanchal27 I think 3 more small iterations, then this should be good to commit.
Co-authored-by: Felix Arntz <[email protected]>
Thanks, @felixarntz, for the feedback! The unit tests have passed now. @joemcgill @felixarntz, this is ready for re-review and commit as the initial part of the solution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR in the current shape makes perfect sense based on the discussion and analysis performed. I would be happy to land it as is, and talk about further enhancements separately as outlined by @joemcgill:
Between the two options, I would expect the filter to behave like it does in render_block(): Context supplied with a filter is made available to inner blocks.
Whether or not we then change the current ability for a block's context property to be modified to include values that a block itself does not have listed in its 'uses_context' property can be a separate decision.
…wordpress-develop into fix/62046-test-approach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the iterations @mukeshpanchal27, this one was a complex one to figure out! Looks good to commit for me, I'm happy to do that.
Paging @joemcgill for another review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest updates and the included tests all look right to me. Thanks @mukeshpanchal27 for sticking with this one to get it over the line and for everyone else for the feedback and testing. Such a tough little problem 😅!
Trac ticket: https://core.trac.wordpress.org/ticket/62046
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.